package com.itheima.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.itheima.pojo.User;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.List;

public interface IUserService extends IService<User> {

    public List<User> findPage(Integer page, Integer pageSize);

    /**
     * 使用poi导出带样式的文件
     * @param response
     */
    void downLoadXlsxByPoi(HttpServletResponse response) throws IOException;

    /**
     * 根据员工id，导出对应的员工详情
     * @param id    员工主键id
     * @param request 请求
     * @param response 响应
     */
    void downLoadUserInfoWithTemplate(Long id, HttpServletRequest request, HttpServletResponse response) throws IOException, InvalidFormatException;

    /**
     * 下载员工合同
     * @param id 员工id
     * @param response 用于导出文件时的响应对象
     */
    void downLoadContract(Long id, HttpServletResponse response) throws FileNotFoundException, Exception;

    /**
     * 使用EasyPOI的方式进行用户信息导出
     * @param response
     */
    void downLoadWithEasyPOI(HttpServletResponse response) throws IOException;

    /**
     * 使用EasyPOI实现表格数据的导入
     * @param file 要导入的表格文件
     */
    void uploadExcelWithEasyPOI(MultipartFile file) throws IOException, Exception;

    /**
     * 使用EasyPOI实现带模板导出表格
     * @param id 员工id
     * @param request 请求
     * @param response 响应
     */
    void downLoadUserInfoWithTemplateForEasyPoi(Long id, HttpServletRequest request, HttpServletResponse response) throws FileNotFoundException, UnsupportedEncodingException, Exception;

    /**
     * 使用EasyPOI实现对word文档的导出
     * @param id 员工id
     * @param response
     */
    void downLoadContractByEasyPOI(Long id, HttpServletResponse response) throws Exception;
}
